#ifndef EDITORTABWIDGET_H
#define EDITORTABWIDGET_H

#include <QTabWidget>
#include "editorexitdialog.h"
#include "texteditor.h"

class EditorTabWidget : public QTabWidget
{
    Q_OBJECT
public:
    explicit EditorTabWidget(QWidget *parent = 0);

    TextEditor * editor(int index) const;

    void newEditor(QString filename);
    TextEditor * currentEditor() const { return this->editor(this->currentIndex()); }
    void saveCurrentFile();
    void closeTab(int index) { onTabCloseRequested(index); }
    
signals:
    
private slots:

    void onTabCloseRequested(int index);
    void onTextChanged(bool modified);
};

#endif // EDITORTABWIDGET_H
